import service from '@/utils/request'

//微信sdk
export const getJsSdk = (data:any) => {
  return new Promise((resolve, reject) => {
    service.get('/api/wechat/jssdk', {params:data})
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//下拉框
export const getCommonSelect = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/common/lov/page', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//下拉框
export const getCropList = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/crop/tanc-crop-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}
//土壤类型列表(APP)
export const getLandTypeList = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-farm-land-type/tanc-farm-land-type-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//地块标签
export const getLandTagsList = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-land-tags/tanc-land-tags-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}
//农场地块统计
export const getFarmLandCount = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/farm/farm-count', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}


//地块分组列表(APP)
export const getFarmGroup = (data:any) => {
  return new Promise((resolve, reject) => {
    service.get('/api/farmland-group/farmland-group-list', {params:data})
      .then((res:any) => {
        resolve(res.data)
      })
  })
}


//地块详情
export const getLandDetail = (data:any) => {
  return new Promise((resolve, reject) => {
    service.get('/api/tanc-farm-land/tanc-farm-land-get', {params:data})
      .then((res:any) => {
        resolve(res.data)
      })
  })
}



export const addLandGroup = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/farmland-group/farmland-group-add', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}
export const delLandTGroup = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/farmland-group/farmland-group-delete', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const eidtLand = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-farm-land/tanc-farm-land-edit', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const getTagsList = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-land-tags/tanc-land-tags-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const addTags = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-land-tags/tanc-land-tags-add', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const delTags = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-land-tags/tanc-land-tags-delete', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const getLandbelongList = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-farm-land-belong/tanc-farm-land-belong-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}
export const addBelong= (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-farm-land-belong/tanc-farm-land-belong-add', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const delBelong= (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-farm-land-belong/tanc-farm-land-belong-delete', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const getGeologyList= (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/farm-land-geology/farm-land-geology-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//农场详情
export const getFarmInfo = (data:any) => {
  return new Promise((resolve, reject) => {
    service.get('/api/farm/farm-get', {params:data})
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

export const getLandMinList= (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc-farm-land/tanc-farm-land-list', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//取值timesId
export const getTimesLands = (data:any) => {
  return new Promise((resolve, reject) => {
    service.get('/api/app-user/get-value', {params:data})
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//任务地块处理次数统计(BOSS)
export const getLandCountList = (data:any) => {
  return new Promise((resolve, reject) => {
    service.post('/api/tanc_planting_plan_task/land/count', data)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//获取当前任务下的地块
export const getPlantingPlanTaskList = (id:any) => {
  return new Promise((resolve, reject) => {
    service.get(`/api/tanc_planting_plan_task/get/${id}`)
      .then((res:any) => {
        resolve(res.data)
      })
  })
}

//已经处理的地块列表(API)-已经估产地块列表
export const getProcessedLandList = (params:any) => {
  return new Promise((resolve, reject) => {
    service.get(`/api/tanc_planting_plan_task_record/processed/land/list`,{params:params})
      .then((res:any) => {
        resolve(res.data)
      })
  })
}